<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateChatMsgTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('chat_msg', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('chat_id')->nullable()->comment('聊天室id');
            $table->integer('user_id')->nullable()->comment('用户id');
            $table->string('msg_type',10)->nullable()->default('text')->comment('消息类型 text文本 image图片 emoji表情');
            $table->string('content',255)->nullable()->comment('消息内容');
            $table->dateTime('create_time')->nullable();
            $table->dateTime('update_time')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('chat_msg');
    }
}
